﻿using System;

class DecimalToBinary
{
    static void Main()
    {
        int deciNum = 255;
        string binary = ConvertDeciToBin(deciNum);

        Console.WriteLine("Decimal: " + deciNum);
        Console.WriteLine("Binary:  " + binary);
    }

    private static string ConvertDeciToBin(int number)
    {
        string binNum = String.Empty;
        int remainder = 0;
        int numBase = 2;

        do
        {
            remainder = number % numBase;
            binNum = remainder + binNum;
            number = number / numBase;
        }
        while (number != 0);

        //binNum = AddLeadingZeros(binNum);
        
        return binNum;
    }

    //private static string AddLeadingZeros(string binNum)
    //{
    //    int int32Digits = 32;

    //    binNum = new string('0', int32Digits - binNum.Length) + binNum;

    //    return binNum;
    //}
}
